package com.uetoken.cn.adapter;

import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.uetoken.cn.R;
import com.uetoken.cn.bean.RechargeNum;


import java.util.List;

/**
 * @author xie
 * @time 2018/11/22 14:30
 * @class 描述:充值adaper
 */
public class RechargeAdapter extends BaseQuickAdapter<RechargeNum, BaseViewHolder> {

    public RechargeAdapter(int layoutResId, @Nullable List<RechargeNum> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, RechargeNum item) {
        LinearLayout container = helper.getView(R.id.ll_item_recharge_container);
        TextView cnv = helper.getView(R.id.tv_item_recharge_v);
        TextView rmb = helper.getView(R.id.tv_item_recharge_dos);
        cnv.setText(item.getCNV()+"");//String.format(mContext.getString(R.string.str_exchange_cnv),item.getCNV()+""));
        rmb.setText(String.format(mContext.getString(R.string.str_need_pay),item.getRMB()+""));
        if (item.isSelect()){
            container.setBackground(ContextCompat.getDrawable(mContext,R.drawable.recharge_blue_shape));
            cnv.setTextColor(ContextCompat.getColor(mContext,android.R.color.white));
            rmb.setTextColor(ContextCompat.getColor(mContext,android.R.color.white));
        }else{
            container.setBackground(ContextCompat.getDrawable(mContext,R.drawable.recharge_white_shape));
            cnv.setTextColor(ContextCompat.getColor(mContext,R.color.textColor_rr));
            rmb.setTextColor(ContextCompat.getColor(mContext,R.color.textColor_rr));
        }
    }
}
